package org.omnifaces.showcase.converters;

import org.omnifaces.showcase.model.ExampleEntity;
import org.omnifaces.showcase.model.ExampleUserData;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import java.util.ArrayList;
import java.util.List;


@ManagedBean
@ViewScoped
public class SelectItemsIndexBean {
    private static final long serialVersionUID = 1L;

    private List<ExampleEntity> exampleEntities;

    private ExampleEntity selectedEntity;


    private List<ExampleUserData> exampleUserDataList;

    private ExampleUserData selectedExampleUserData;

    @PostConstruct
    public void init() {
        exampleEntities = new ArrayList<ExampleEntity>();
        exampleEntities.add(new ExampleEntity(1L, "Amsterdam"));
        exampleEntities.add(new ExampleEntity(2L, "Frankfurt"));
        exampleEntities.add(new ExampleEntity(3L, "London"));

        exampleUserDataList = new ArrayList<ExampleUserData>();
        exampleUserDataList.add(new ExampleUserData("Tester","tester.test@company.com"));
        exampleUserDataList.add(new ExampleUserData("Dummy","dummy.user@test.com"));
        exampleUserDataList.add(new ExampleUserData("Another User","another.user@provider.com"));

    }

    public List<ExampleEntity> getExampleEntities() {
        return exampleEntities;
    }

    public ExampleEntity getSelectedEntity() {
        return selectedEntity;
    }

    public void setSelectedEntity(ExampleEntity selectedEntity) {
        this.selectedEntity = selectedEntity;
    }

    public ExampleUserData getSelectedExampleUserData() {
        return selectedExampleUserData;
    }

    public void setSelectedExampleUserData(ExampleUserData selectedExampleUserData) {
        this.selectedExampleUserData = selectedExampleUserData;
    }

    public List<ExampleUserData> getExampleUserDataList() {
        return exampleUserDataList;
    }
}
